package com.sanpu.kxe.business.trade.bean;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import java.math.BigDecimal;

/**
 * Description：支付限额
 * Created by 薛勇军 on 2018/8/1.
 */

public class PayLimit implements Parcelable {

    private BigDecimal min;
    private BigDecimal max;

    public PayLimit(BigDecimal min, BigDecimal max) {
        this.min = min;
        this.max = max;
    }

    public PayLimit(String min, String max) {
        if (!TextUtils.isEmpty(min)) {
            this.min = new BigDecimal(min);
        }
        if (!TextUtils.isEmpty(max)) {
            this.max = new BigDecimal(max);
        }
    }

    public BigDecimal getMin() {
        return min;
    }

    public void setMin(BigDecimal min) {
        this.min = min;
    }

    public BigDecimal getMax() {
        return max;
    }

    public void setMax(BigDecimal max) {
        this.max = max;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeSerializable(this.min);
        dest.writeSerializable(this.max);
    }

    protected PayLimit(Parcel in) {
        this.min = (BigDecimal) in.readSerializable();
        this.max = (BigDecimal) in.readSerializable();
    }

    public static final Parcelable.Creator<PayLimit> CREATOR = new Parcelable.Creator<PayLimit>() {
        @Override
        public PayLimit createFromParcel(Parcel source) {
            return new PayLimit(source);
        }

        @Override
        public PayLimit[] newArray(int size) {
            return new PayLimit[size];
        }
    };
}
